
TARGET_MODULE := $(MAKECMDGOALS)
SRC_FILE := $(MAKECMDGOALS).c

CC := gcc
CFLAGS :=-lglut -lGLU

ifeq ($(TARGET_MODULE),$(wildcard $(TARGET_MODULE)))
$(shell rm -f $(TARGET_MODULE))
endif

$(MAKECMDGOALS):
ifneq ($(SRC_FILE),$(wildcard $(SRC_FILE)))
	$(error "source file $(SRC_FILE) doesn't exist")
endif
	$(CC) -o $(TARGET_MODULE) $(SRC_FILE) $(CFLAGS)

all:
	@echo "Please specify a target!"
